package com.sesame.feign;


import kim.sesame.common.result.ApiResult;
import kim.sesame.framework.web.response.ResponseFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;


@FeignClient(name = FeignServiceTest.APP_NAME, fallback = FeignServiceTestHystrix.class)
public interface FeignServiceTest {

    String APP_NAME = "spring-cloud-example-feign-service";
    String SERVICE_NAME = "";// 项目路径

    @RequestMapping(value = SERVICE_NAME + "/test/getData")
    Response<String> test(
            @RequestParam("name") String name
            , @RequestParam("pwd") String pwd
    );

}
@Component
class FeignServiceTestHystrix implements FeignServiceTest {
    @Override
    public ApiResult test(String name, String pwd) {
        return ResponseFactory.feignException("test");
    }
}
